﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using UnwiseSource.ServiceReference1;

namespace UnwiseSource.Administration
{
    public partial class AdminToolM : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            UserCredibility userCreds = ((UserCredibility)Session["userCreds"]);
            RedirectBackToLoginIfNotLogged(userCreds);
        }

        private void RedirectBackToLoginIfNotLogged(UserCredibility userCreds)
        {
            bool redirectBack = true;

            if (userCreds != null)
            {
                if (userCreds.Credible)
                {
                    redirectBack = false;
                }
            }

            if (redirectBack)
            {
                Response.Redirect("~/Administration/Login.aspx");
            }
        }
    }
}